#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

int main()
{
	int num = 0;
	for (int i = 0; i < 10000; i++)
	{
		int tmp = num;
		int t = 0;
		int sum = 0;
		while (tmp) {
			t++;
			tmp /= 10;
		}
		 tmp = num;
		while (tmp) {
			sum += pow(tmp % 10, t);
			tmp /= 10;
		}
		if (sum == num) {
			printf("%d ", num);

		}
		num++;
	}
	return 0;
}